package com.central.apps.handler.MaterialInventory;

import com.central.app.service.HandlerService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

//采购接收入库接口
@RestController
public class PurchaseReReceiptHandler {
    @Autowired
    private HandlerService handlerService;
    @PostMapping("/purchaseRe")
    public String receiptnum(@RequestBody Map<String,Object> params) throws Exception{
        String receiptnum = MapUtils.getString(params, "receiptnum");
        List<Map<String, Object>> bySql = handlerService.findBySql(" \n" +
                "SELECT\n" +
                "\ta.*,\n" +
                "\tb.* \n" +
                "FROM\n" +
                "\tgq_purchasereceipt a\n" +
                "\tLEFT JOIN gq_prtdetailline b ON a.receiptnum = b.receiptnum \n" +
                "WHERE\n" +
                "\ta.receiptnum = '" + receiptnum + "'");
        if (CollectionUtils.isNotEmpty(bySql)){
            for (int i=0;i<bySql.size();i++){
                Map<String, Object> map = bySql.get(i);
            }

        }
        return  null;
    }
}
